package com.dmp.pushlogs.bolt;

import com.dmp.common.date.DateUtils;
import com.dmp.storm.bolt.BaseMapBolt;

import java.util.Date;
import java.util.Map;

/** 
 * @ClassName customBolt
 * @Description 
 *
 * @author  sunzy 
 * @date 2016年4月14日 下午7:49:23 
 * @version 1.0 
 *
 */
public class FeCustomBolt extends BaseMapBolt {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1797212540641047767L;

	@Override
	public Map<String, Object> process(Map<String, Object> map) {
		Map<String, Object> record = map;
		
		// start_time 毫秒-> yyyyMMddHHmmss
		String timeStr = (String) map.get("fe_time");	
		long timeL = Long.valueOf(timeStr).longValue();
		Date date = new Date(timeL);
		timeStr = DateUtils.formatDate(date, "yyyyMMddHHmmss");
		record.put("fe_time", timeStr);
		
		// 其它时间
		record.put("hour", DateUtils.formatDate(date, "yyyyMMddHH"));
		record.put("hour_h", DateUtils.formatDate(date, "HH"));
		record.put("day", DateUtils.formatDate(date, "yyyyMMdd"));
		record.put("day_d", DateUtils.formatDate(date, "dd"));
		record.put("month", DateUtils.formatDate(date, "yyyyMM"));
		record.put("month_m", DateUtils.formatDate(date, "MM"));
		//日志时间
		record.put("log_date", DateUtils.formatDate(date, "yyyy/MM/dd HH:mm:ss"));
		return record;
	}
	
}
